package lzzy5;

public class Student implements Comparable<Student>{
    public String name;
    public String clas;
    public double achievement;

    public Student(String name, String clas, double achievement){
        this.name=name;
        this.clas=clas;
        this.achievement=achievement;
    }

    @Override
    public String toString(){
        return "Student{" +
                ", name='" + name + '\'' +
                ", stu_id='" + clas + '\'' +
                ",achievement='" + achievement + '\'' +
                '}';
    }

    public int compareTo(Student o) {
        if (achievement > o.achievement)
            return 1;
        else if (achievement < o.achievement)
            return -1;
        else
            return 0;
    }
}
